package com.heima.bos.web.interceptor;

import com.heima.bos.domain.User;
import com.heima.bos.utils.BOSUtils;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
/**
 * 判断用户是否登录拦截器
 * @author Administrator
 *
 */
@SuppressWarnings("all")
public class BOSInterceptor extends MethodFilterInterceptor {

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {

		User user = (User) BOSUtils.getSession().getAttribute("user");
		//拦截
		if(user == null){
			System.out.println("未放行");
			return "login";
		}
		//放行
		return invocation.invoke();
	}

}
